package ljt.music.module.tab2;

import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import ljt.music.R;
import ljt.music.module.base.BaseFragment;
import ljt.music.ui.playlist.PlayListActivity;

/**
 * 热门页面
 *
 * @author jiangtao
 * @date 2017/11/25
 */
public class Tab2Fragment extends BaseFragment implements View.OnClickListener {

  private static Tab2Fragment instance;

  private TextView tv_1;
  private TextView tv_2;
  private TextView tv_3;
  private TextView tv_4;
  private TextView tv_5;
  private TextView tv_6;
  private TextView tv_7;
  private TextView tv_8;

  public static Tab2Fragment getInstance() {
    if (instance == null) {
      instance = new Tab2Fragment();
    }
    return instance;
  }

  @Override
  protected int attachLayoutId() {
    return R.layout.fragment_tab2;
  }

  @Override
  protected void initView(View view) {
    tv_1 = view.findViewById(R.id.tv_1);
    tv_2 = view.findViewById(R.id.tv_2);
    tv_3 = view.findViewById(R.id.tv_3);
    tv_4 = view.findViewById(R.id.tv_4);
    tv_5 = view.findViewById(R.id.tv_5);
    tv_6 = view.findViewById(R.id.tv_6);
    tv_7 = view.findViewById(R.id.tv_7);
    tv_8 = view.findViewById(R.id.tv_8);

    tv_1.setOnClickListener(this);
    tv_2.setOnClickListener(this);
    tv_3.setOnClickListener(this);
    tv_4.setOnClickListener(this);
    tv_5.setOnClickListener(this);
    tv_6.setOnClickListener(this);
    tv_7.setOnClickListener(this);
    tv_8.setOnClickListener(this);
  }

  @Override
  protected void initData() {

  }

  @Override
  public void onClick(View v) {
    Intent intent = new Intent(getActivity(), PlayListActivity.class);
    switch (v.getId()) {
      //热歌榜
      case R.id.tv_1:
        intent.putExtra("types", "playlist");
        intent.putExtra("id", "3778678");
        intent.putExtra("source", "");
        startActivity(intent);
        break;
      case R.id.tv_2:
        intent.putExtra("types", "playlist");
        intent.putExtra("id", "19723756");
        intent.putExtra("source", "");
        startActivity(intent);
        break;
      case R.id.tv_3:
        intent.putExtra("types", "playlist");
        intent.putExtra("id", "3779629");
        intent.putExtra("source", "");
        startActivity(intent);
        break;
      case R.id.tv_4:
        intent.putExtra("types", "playlist");
        intent.putExtra("id", "2884035");
        intent.putExtra("source", "");
        startActivity(intent);
        break;
      case R.id.tv_5:
        intent.putExtra("types", "playlist");
        intent.putExtra("id", "934013820");
        intent.putExtra("source", "");
        startActivity(intent);
        break;
      case R.id.tv_6:
        intent.putExtra("types", "playlist");
        intent.putExtra("id", "71384707");
        intent.putExtra("source", "");
        startActivity(intent);
        break;
      case R.id.tv_7:
        intent.putExtra("types", "playlist");
        intent.putExtra("id", "71385702");
        intent.putExtra("source", "");
        startActivity(intent);
        break;
      case R.id.tv_8:
        intent.putExtra("types", "playlist");
        intent.putExtra("id", "60198");
        intent.putExtra("source", "");
        startActivity(intent);
        break;
      default:
    }
  }
}
